package edu.chl.jadetalk.user;

import edu.chl.jadetalk.core.User;
import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
 * Holds the user session.
 * @author Daniel
 */
@ManagedBean
@SessionScoped
public class UserSessionBean implements Serializable {

    private User user;

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
        Logger.getAnonymousLogger().log(Level.INFO, "Setting session username to: {0}", user);
    }
    
    public boolean isLoggedIn() {
        return user != null;
    }
}
